import http from './http.js'
//登录
export const LoginRuder =(username,password) =>  http.post('/login',{username,password})

//获得菜单权限
export const LeftMenu = () => http.get('/menus')

//查询用户列表
export const getUser = (pagenum,pagesize) => http.get(`/users?pagenum=${pagenum}&pagesize=${pagesize}`)

//修改用户状态
export const ChangeUser =(uid ,type) => http.put(`users/${uid}/state/${type}`)

//添加用户
export const addUser =(username,password,email,mobile) => http.post('/users',{username,password,email,mobile})

//删除用户
export const DeleteUser =(uid) => http.delete(`users/${uid}`)

//搜索用户
export const SearchUser =(uid) => http.get(`users/${uid}`)

//编辑用户信息
export const reviseUser = (uid,email,mobile) => http.put(`users/${uid}`,{uid,email,mobile})

//分配用户角色
export const userRole = (id, rid ) => http.put(`users/${id}/role`,{rid})



//角色列表
export const getRole = () => http.get(`/roles`)

//添加角色
export const AddRole = (roleName,roleDesc) => http.post(`/roles`,{roleName,roleDesc})

//删除角色
export const DeleteRole =(id) => http.delete(`roles/${id}`)

//编辑角色
export const revisRole = (id,roleName, roleDesc) => http.put(`roles/${id}`,{id,roleName, roleDesc})

//获得权限列表
export const getRoleList = (type) => http.get(`rights/${type}`)

//删除角色指定权限
export const DeleteRoleid = (roleId,rightId) =>http.delete(`roles/${roleId}/rights/${rightId}`)

//角色授权
export const reviseQx = (roleId,rids) =>http.post(`roles/${roleId}/rights`,{rids})

//基于时间统计的折线图
export const getData =() =>http.get('reports/type/1')



//商品列表数据
export const getGoodsList =(Info) =>http.get('goods',{params:Info})

//根据 ID 查询商品
export const SearchGood =(id) => http.get(`goods/${id}`)

//删除商品
export const Deletegood =(id) => http.delete(`goods/${id}`)

//添加商品
export const AddShop =(goodsInfo) =>http.post('goods',goodsInfo)


// 商品分类数据列表
export const gettypeList =(Info) => http.get('categories',{params:Info})

//删除分类
export const deletype = (id) => http.delete(`categories/${id}`)

//添加分类
export const addType =( {cat_name ,cat_level , cat_pid}) =>http.post('categories',{cat_name ,cat_level , cat_pid})

//编辑提交分类
export const revisType = (id,cat_name) => http.put(`categories/${id}`,{cat_name})


//参数列表
export const NumList =(id,type) => http.get(`categories/${id}/attributes`,{params:{sel:type}})

//添加动态参数或者静态属性
export const AddNumList = (id,attr_name,attr_sel, attr_vals) =>http.post(`categories/${id}/attributes`,{attr_name,attr_sel,attr_vals})

//删除参数
export const DeleteNum =(id,attrid) =>http.delete(`categories/${id}/attributes/${attrid}`)

//编辑提交参数
export const gengxinNum =(id,attrId,attr_name,attr_sel,attr_vals) =>http.put(`categories/${id}/attributes/${attrId}`,{attr_name,attr_sel,attr_vals})


//订单数据列表
export const getOrderList = (Info) =>http.get('orders',{params:Info})

//修改订单状态
export const GxOrderStatus = (id) =>http.put(`orders/${id}`)

//查看订单详情
export const  GetOrderDetail = (id) => http.get(`orders/${id}`)

//查看物流信息
export const GetwuliuInfo = (id) =>http.get(`/kuaidi/${id}`)

//图片上传
export const UpLoadPic =() => http.post('upload')
